<template>
	<view class="content">
		
		<view class="colonn"
		style="position: fixed;top: 0rpx;left: 0rpx;background-color: white;"
		>
			<view class="roww center_center w-700 m-all-25" v-if="userInfowx">
				<image @longtap="longheart" :src="userInfowx.user.avatar" class="w-130 h-130"
					style="border-radius: 50%;background-color: #c0c0c0;"></image>
				<view class="w-25"></view>
				<view class="colonn h-120 rowsa">
					<view @longtap="longShowimg">{{userInfowx.user.nickName}}</view>
					<view>部门：{{userInfowx.user.deptName}}</view>
					<view @longtap="longPwd">职位：{{userInfowx.user.position}}</view>
				</view>
				<view class="allline"></view>
			</view>
			<view class="w-750" >
				<picker :range="shopList" range-key="channel_name"
				@change="shopChange"
				>
					<view class="roww w-750 p-all-20 fs-35 border_bottom">
						<view style="color: red;"
						 class="fw-b w-550"
						 v-if="shopInfo.channel_id">{{shopInfo.channel_name}}</view>
						 <view style="color: red;"
						  class="fw-b"
						  v-else>未选择门店</view>
						<view class="allline"></view>
						<view v-if="shopInfo.channel_id">点击切换</view>
						<view v-else>点击请选择> </view>
					</view>
				</picker>
			</view>
		</view>
		
		<view class="h-290"></view>
		<view class="roww center_center">
			<view>只针对发货单进行扫码入库</view>
		</view>
		
		<view class="colonn background1  w-710 m-all-20 m-bottom-20" 
		v-for="item in orderList">
			<view class="roww w-750 border_bottom p-all-20">
				<view>创建时间：{{item.gmtCreate}}</view>
				<view class="allline"></view>
			</view>
			<view class="roww w-750 border_bottom p-all-20">
				<view>发货单编号：{{item.orderNo}}</view>
				<view class="allline"></view>
			</view>
			<view class="roww w-750 border_bottom p-all-20">
				<view>发货仓库：{{item.warehouseName}}</view>
				<view class="allline"></view>
			</view>
			<view class="roww w-750 border_bottom p-all-20">
				<view>发货时间：{{item.sendTime}}</view>
				<view class="allline"></view>
			</view>
			<!-- <view class="roww w-750 border_bottom p-all-20">
				<view>状态：{{item.orderStatusName}}</view>
				<view class="allline"></view>
			</view> -->
			<view class="roww w-750 border_bottom p-all-20">
				<view>补货单编号：{{item.platOrderNo}}</view>
				<view class="allline"></view>
			</view>
			<!-- <view class="roww w-750 border_bottom p-all-20">
				<view>店铺名称：{{item.buyerName}}</view>
				<view class="allline"></view>
			</view> -->
			<view class="roww w-750 border_bottom p-all-20">
				<view class="w-680">备注：{{item.mergeMemo}}</view>
				<view class="allline"></view>
			</view>
			<view class="roww p-all-20">
				<view class="allline"></view>
				<view 
				@click.stop="toInfo(item)"
				style="background-color:red;font-size: 25rpx;color:white;padding:10rpx 20rpx;border-radius: 100rpx;"
				>点击去入库</view>
			</view>
		</view>
		
		<view class="roww center_center m-top-85" 
		v-if="orderList.length<=0">
			<view>未查到发货单</view>
		</view>
		
		<view @click.stop="toDianjiruku" class="roww sasa center_center"  v-if="orderInfo_orderInfo"
		>
			<view>重新进入</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello',
				shopList:[],
				shopInfo:{},
				orderList:[],
				userInfowx:null,
				orderInfo_orderInfo:null
			}
		},
		onLoad() {
			setTimeout(res=>{
				this.userInfowx = uni.getStorageSync("userInfowx");
			},1000)
			var shopInfo=uni.getStorageSync("shopInfo");
			if(shopInfo){
				this.shopInfo=shopInfo;
				this.getBhOrderList();
			}
			this.getShopList()
		},
		onShow() {
			var orderInfo_orderInfo=uni.getStorageSync("orderInfo_orderInfo");
			if(orderInfo_orderInfo){
				this.orderInfo_orderInfo=orderInfo_orderInfo;
			}
		},
		methods: {
			
			// 历史记录
			toDianjiruku(){
				uni.removeStorageSync('orderInfo');
				uni.navigateTo({
					url:"/pages/orderInfo/orderInfo?uptype=1"
				})
			},
			
			// 是否提交
			isSubmit(){
				
			},
			toInfo(item){
				uni.setStorageSync("orderInfo",item);
				uni.navigateTo({
					url:"/pages/orderInfo/orderInfo"
				})
			},
			getBhOrderList(){
				var data =this.shopInfo
				this.$axios
					.axios('post', this.$paths.getSendCargoListsPost, data)
					.then((res) => {
						if (res.code == 200) {
							this.orderList=res.result.data
						} else {
							this.$tools.showToast(res.msg);
						}
					})
					.catch((err) => {
						console.log('错误回调', err);
					});
			},
			shopChange(res){
				this.shopInfo=this.shopList[parseInt(res.detail.value)];
				uni.setStorageSync("shopInfo",this.shopInfo)
				this.getBhOrderList();
			},
			getShopList(){
				var data = {
				}
				var userInfowx=uni.getStorageSync("userInfowx");
				console.log('userInfowx',userInfowx)
				if(userInfowx){
					data.username=userInfowx.user.nickName
				}
				this.$axios
					.axios('post', this.$paths.getShopList, data)
					.then((res) => {
						if (res.code == 200) {
							var shopList=res.result.data
							var res=[];
							for(var a=0;a<shopList.length;a++){
								if(shopList[a].channel_name.indexOf('最西域-')>=0){
									 res.push(shopList[a]);
								}
							}  
							this.shopList=res;
						} else {
							this.$tools.showToast(res.msg);
						}
					})
					.catch((err) => {
						console.log('错误回调', err);
					});
			}
		}
	}
</script>

<style>
	page{
		background-color: #f5f5f5;
	}
	.sasa{
		
		width: 500rpx;height: 80rpx;background-color: red;color: white;text-align: center;border-radius: 100rpx;line-height:80rpx;font-size: 30rpx;text-align: center;
		position: fixed;bottom: 50rpx;
		left: 125rpx;
	}
	
</style>
